import 'dart:async';

import 'package:baidu_trace/call_back.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'baidu_trace_method_channel.dart';

abstract class BaiduTracePlatform extends PlatformInterface {
  /// Constructs a BaiduTracePlatform.
  BaiduTracePlatform() : super(token: _token);

  static final Object _token = Object();

  static BaiduTracePlatform _instance = MethodChannelBaiduTrace();

  /// The default instance of [BaiduTracePlatform] to use.
  ///
  /// Defaults to [MethodChannelBaiduTrace].
  static BaiduTracePlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [BaiduTracePlatform] when
  /// they register themselves.
  static set instance(BaiduTracePlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }


  ///添加回调监听
  void setTraceListener();

  Stream<BaiduListener> getStream();

  ///初始化百度鹰眼
  Future<bool?> initSdk(Map<String,dynamic> args) {
    throw UnimplementedError('initSdk() has not been implemented.');
  }

  ///添加实体
  /// [tag] - 请求标识
  /// [serviceId] - 轨迹服务ID
  /// [entityName] - entity标识
  /// [entityDesc] - entity描述
  /// [columns] - 自定义属性字段
  Future<bool?> addEntity(int tag, int serviceId, String entityName,
      {String? entityDesc, Map<String, String>? columns}) {
    throw UnimplementedError('addEntity() has not been implemented.');
  }

  ///更新实体
  /// [tag] - 请求标识
  /// [serviceId] - 轨迹服务ID
  /// [entityName] - entity标识
  /// [entityDesc] - entity描述
  /// [columns] - 自定义属性字段
  Future<bool?> updateEntity(int tag, int serviceId, String entityName,
      {String? entityDesc, Map<String, String>? columns}) {
    throw UnimplementedError('updateEntity() has not been implemented.');
  }

  ///开启轨迹服务
  /// [serviceId] - 轨迹服务ID
  /// [entityName] - entity标识
  Future<bool?> startTrace(int serviceId, String entityName) {
    throw UnimplementedError('startTrace() has not been implemented.');
  }

  ///停止轨迹服务
  /// [serviceId] - 轨迹服务ID
  /// [entityName] - entity标识
  Future<bool?> stopTrace(int serviceId, String entityName) {
    throw UnimplementedError('stopTrace() has not been implemented.');
  }

  ///开始上报轨迹
  Future<bool?> startGather() {
    throw UnimplementedError('startGather() has not been implemented.');
  }

  ///停止上报轨迹
  Future<bool?> stopGather() {
    throw UnimplementedError('stopGather() has not been implemented.');
  }
}
